package com.dashboard.tuyensinh;

import java.sql.ResultSet;
import java.util.ArrayList;

import com.lb.jwitter.connectDatabase.ConnectTuyenSinh;
import com.opensymphony.xwork2.Action;

public class ListNamHocAction {
	private ArrayList<String> listNamHoc;
	public ArrayList<String> getListNamHoc() {
		return listNamHoc;
	}

	public void setListNamHoc(ArrayList<String> listNamHoc) {
		this.listNamHoc = listNamHoc;
	}

	
	/////////////////////////////////////////////////////////
	
	
	public String execute() throws Exception
	{
		listNamHoc=new ArrayList<String>();
		ConnectTuyenSinh connection= new ConnectTuyenSinh();
		if(connection.getConnection()!=null){
			
			
			String query="select distinct nam from tuyensinh";
			
			ResultSet data=connection.getData(query);
			if(data!=null){
				while(data.next()){
					listNamHoc.add(data.getString("nam"));
				}
			}
			
		}
		connection.closeConnection();
		return Action.SUCCESS;

	}
}
